import random


names=['a','b','c','d','e','f','g','h']

ct1 = []
ct2 = []
ct3 = []

for i in names:
    ct = random.randint(1,3)
    if ct == 1:
        ct1.append(i)
    elif ct == 2:
        ct2.append(i)
    elif ct == 3:
        ct3.append(i)

print(f"第1个办公室分配的老师为:{ct1}")
print(f"第2个办公室分配的老师为:{ct2}")
print(f"第3个办公室分配的老师为:{ct3}")
